package ru.urfc.portal.ui.client.validators;

import com.extjs.gxt.ui.client.widget.form.Field;
import com.extjs.gxt.ui.client.widget.form.Validator;

/**
 * Class {@link Validator} does not exist in result war,
 * but some validators can be used on server side again 
 */
public class GxtAdapter implements Validator {

	public static final GxtAdapter EMAIL_VALIDATOR = new GxtAdapter(EmailValidator.INSTANCE);
	
	private BaseValidator validator;
	
	public GxtAdapter(BaseValidator validator) {
		this.validator = validator;
	}

	@Override
	public String validate(Field<?> field, String value) {
		return validator.validate(value);
	}
	
}
